home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 1 / CU Amiga Magazine CD-ROM Special Edition (1995)(EMAP Images)(GB)[Issue 1995-11].iso / Aminet / comm / tcp / ATCP_sdk_40_gc.lha / AmiTCP-4.0-gcc / src / netlib / printuserfault.c < prev    next >
C/C++ Source or Header  |  1995-03-29  |  1KB  |  55 lines

  1. /*
  2.  *    printuserfault.c - Print a usergroup error message (DOS)
  3.  *
  4.  *    Copyright © 1994 AmiTCP/IP Group,
  5.  *             Network Solutions Development Inc.
  6.  *             All rights reserved.
  7.  */
  8.  
  9. /****** net.lib/PrintUserFault ************************************************
  10.  
  11.     NAME
  12.     PrintUserFault - socket error messages
  13.  
  14.     SYNOPSIS
  15.     PrintUserFault(code, banner)
  16.     void PrintUserFault(LONG, const UBYTE *)
  17.  
  18.     FUNCTION
  19.     The PrintUserFault() function finds the error message corresponding to
  20.     the code and writes it, followed by a newline, to the standard error
  21.     or Output() filehandle. If the argument string is non-NULL it is
  22.     preappended to the message string and separated from it by a colon and
  23.     space (`: '). If string is NULL only the error message string is
  24.     printed.
  25.  
  26.     NOTES
  27.     The PrintUserFault() function used the DOS io functions.  It is
  28.     recommended to use PrintUserFault() when the standard C IO functions
  29.     are not otherwise in use.
  30.  
  31.     SEE ALSO
  32.     strerror(), perror(), <netinclude:sys/errno.h>
  33.  
  34. ******************************************************************************
  35. */
  36.  
  37. #include <errno.h>
  38. #include <exec/types.h>
  39. #include <clib/netlib_protos.h>
  40. #include <stdio.h>
  41.  
  42. void PrintUserFault(LONG code, const char *banner)
  43. {
  44.  
  45.   if (banner != NULL) {
  46.     fputs(banner,stderr);
  47.     fputs(": ",stderr);
  48.   }
  49.  
  50.   fputs((char *)ug_StrError(code),stderr);
  51.   fputs("\n",stderr);
  52.   flush(stderr);
  53. }
  54.  
  55.